// Metgine/Core/Object.h
//
// Copyright 2011 Phillip Stephens
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// Linking this library statically or dynamically with other modules is
// making a combined work based on this library.  Thus, the terms and
// conditions of the GNU General Public License cover the whole
// combination.

#ifndef __OBJECT_H__
#define __OBJECT_H__

#include <string>
#include <SFML/Graphics.hpp>

#include <Metgine/Core/Math.h>
#include <Metgine/Core/Renderer.h>
#include <Metgine/Graphics/Tile.h>
#include <Metgine/Graphics/Sprite.h>

namespace Metgine
{

namespace Core
{
class World;

namespace ObjectType
{

enum ObjectType
{
    // DO NOT MODIFY!!!!
    Any                = -1,
    Unknown,
    Monster,
    Player,
    Projectile,        // A projectile such as a grenade
    Pickup,            // An object that can be picked such as energy, or an E-Tank
    // Add object types after this

    Count // This must be last!!!
};
}; // ObjectType

class METGINE_API Object
{
public:

    virtual void BuildPhysBody();
    virtual void Update(float frametime);
    virtual void Render();
    void SetOwner(Object* owner);

private:
    ObjectType::ObjectType         m_type;                // Object type

protected:

    std::string                    m_name;                // Object name
    Object*                        m_owner;               // Pointer to the object which created the object
    Graphics::Sprite               m_sprite;
    Vector2f                       m_position;

    bool                           m_alive;               // Is this object alive (dead objects are removed by the world)
    int                            m_hps;                 // Hit points
    bool                           m_invulnerable;        // Is this object immune to harm

protected:

    // Constructor
    Object(Object* creator, ObjectType::ObjectType t);
};

std::string ObjectTypeToString(ObjectType::ObjectType type);

}; // Core
}; // Metgine
#endif // OBJECT_H_
